package com.jml.controller;

import com.jml.vo.Member;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.Date;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MemberController {

	@ApiOperation(value="该方法的作用" ,notes="对方法的说明")
	@ApiImplicitParams({
			@ApiImplicitParam(name="操作信息的名字",value="操作信息的具体内容",required=true,dataType = "类型(随意写)")
	})
	@RequestMapping(value = "/member/add",method=RequestMethod.POST)
	public Object add(@RequestBody Member member) {	//@RequestBody 表示当前的配置可以直接将参数变为VO对象
		System.err.println("【MemberController.add()接收对象】" + member);
		return true;
	}

	@ApiOperation(value="获取指定编号人员信息" ,notes="传入mid就可获取人员信息")
	@ApiImplicitParams({
			@ApiImplicitParam(name="mid",value="",required=true,dataType = "类型(随意写)")
	})
	@RequestMapping(value = "/member/get/{mid}",method=RequestMethod.GET)
	public Member get(@PathVariable("mid") long mid) {
		Member vo = new Member();
		vo.setMid(mid);
		vo.setName("mldnjava - " + mid);
		vo.setBirthday(new Date());
		vo.setSalary(99999.99);
		vo.setAge(16);
		return vo;
	}



}
